<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>小程序添加商品</title>
  <!--  <link href="../assets/css/layer.css"  />-->
    <link href="../assets/css/bootstrap.css" rel="stylesheet" />
    <link rel="stylesheet" href="../assets/css/bootstrapValidator.min.css" />
    <link rel="stylesheet" href="../assets/layui/layui-v2.5.4/css/layui.css"  media="all">
</head>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<style>

    h4{
        color: #6379BA;
        padding: 10px;
    }

    .input{
        color: red;
    }

    .img-thumbnail {
        width: 100px !important;
        height: 100px !important;
    }

    .close{
        float: right;
        font-size: 21px;
        font-weight: 700;
        line-height: 1;
        color: #000;
        text-shadow: 0 1px 0 #fff;
        filter: alpha(opacity=20);
        opacity: .2;
    }

    .multi-item{
        float: left;
    }
    /* body{background:#F1F1F1;}*/
</style>
<body>

<div class="form-content">
    <form id="form-user-add" class="form-horizontal">
        <input name="deptId" type="hidden" id="treeId"/>
        <hr />
        <div class="row">
            <div class="col-xs-12">
                <div class="form-group">
                        <label class="col-xs-4 control-label"><span style="color: red; ">*</span>开始时间：</label>
                        <div class="col-xs-4">
                            <input name="strattime" autocomplete="off";  type="text" class="layui-input" id="strattime" placeholder="请选择开始时间">
                        </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-xs-4 control-label"><span style="color: red; ">*</span>结束时间：</label>
                    <div class="col-xs-4">
                        <input name="endtime"  autocomplete="off";  type="text" class="layui-input" id="endtime" placeholder="请选择结束时间">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-xs-4 control-label"><span style="color: red; ">*</span>配送时间：</label>
                    <div class="col-xs-4">
                        <input name="distributiontime"  autocomplete="off";  type="text" class="layui-input" id="distributiontime" placeholder="请选择配送时间">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-xs-4 control-label"><span style="color: red; ">*</span>成团人数：</label>
                    <div class="col-xs-4" id="userId">
                        <input name="cloudsNum"     placeholder="请输入成团人数" class="form-control" type="number" maxlength="20" required>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-xs-4 control-label"><span style="color: red; ">*</span>团长佣金：</label>
                    <div class="col-xs-4 col-xs-12">
                        <div class="input-group">
                            <input name="commission" type="number" maxlength="2" id="commission" placeholder="请输入团长佣金比" class="form-control" value=""/>
                            <span class="input-group-addon">%</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<script src="../assets/js/jquery-3.4.1.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../assets/js/bootstrapValidator.min.js"></script>
<!-- <script src="../assets/js/pages-js/InternalEmployees.js" charset="utf-8"></script>-->
<script src="../assets/layui/layui-v2.5.4/layui.js" charset="utf-8"></script>
<script src="../assets/js/layer.js"></script>
</body>

<script type="text/javascript">

    layui.use('laydate', function(){
        var laydate = layui.laydate;
        laydate.render({
        elem: '#strattime'
        ,type: 'datetime'
        ,trigger: 'click'
        ,min:0
        });

        laydate.render({
            elem: '#endtime'
            ,type: 'datetime'
            ,trigger: 'click'
            ,min:0
        });

        laydate.render({
            elem: '#distributiontime'
            ,type: 'datetime'
            ,trigger: 'click'
            ,min:0
        });
    });

    function  addWxSpell() {
        var strattime=$("input[name='strattime']").val();
        var endtime=$("input[name='endtime']").val();
        var distributiontime=$("input[name='distributiontime']").val();
        var cloudsNum=$("input[name='cloudsNum']").val();
        var commission=$("input[name='commission']").val();
        if(strattime!=""&&endtime!=""&&distributiontime!=""&&cloudsNum!=""&&commission!="")
        {
            $.post("/wxSpell/addWxSpell",{
                strattime:strattime,
                endtime:endtime,
                distributiontime:distributiontime,
                cloudsNum:cloudsNum,
                commission:commission
            },function (result) {
                if(result>0)
                {
                    parent.layer.msg('添加拼团信息成功！',function() {time:1});
                    setInterval(function(){
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    },1000);
                }else{
                    parent.layer.msg("开团时间不能超过最新一次结束拼团时间！");
                    setInterval(function(){
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                         parent.layer.close(index); //再执行关闭
                    },1000);
                }
            });
        }else {
            parent.layer.msg("拼团信息不能为空！");
        }


    }



</script>
</html>
